package com.example.runningdemo.designModel;

/**
 * @program: Running-Demo
 * @description: 静态内部
 * @author: kangwei
 * @create: 2024-08-07 09:27
 **/
public class Singleton {

    private Singleton() {
    }

    // 静态内部类
    private static class InnerSingleton {
        // 实例对象
        private static final Singleton INSTANCE = new Singleton();
    }

    // 获取实例对象
    public static Singleton getInstance() {
        return InnerSingleton.INSTANCE;
    }

    public static void main(String[] args) {
        System.out.println(Singleton.getInstance());
    }
}
